package com.ruowei.modules.foodOrder.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.Size;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 订单明细表
 */
@ApiModel(description = "订单明细表")
@Entity
@Table(name = "order_item")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class OrderItem implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 明细编码
     */
    @ApiModelProperty(value = "明细编码")
    @Column(name = "item_code")
    private String itemCode;

    /**
     * 订单编码
     */
    @ApiModelProperty(value = "订单编码")
    @Column(name = "order_code")
    private String orderCode;

    /**
     * 商品编码
     */
    @ApiModelProperty(value = "商品编码")
    @Column(name = "merchandise_code")
    private String merchandiseCode;

    /**
     * 商品名称
     */
    @ApiModelProperty(value = "商品名称")
    @Column(name = "merchandise_name")
    private String merchandiseName;

    /**
     * 商品规格 文字描述
     */
    @ApiModelProperty(value = "商品规格文字描述")
    @Column(name = "jhi_specification")
    private String specification;

    /**
     * 图片
     */
    @Size(max = 2000)
    @ApiModelProperty(value = "图片")
    @Column(name = "photos", length = 2000)
    private String photos;

    /**
     * 单价
     */
    @ApiModelProperty(value = "单价")
    @Column(name = "unit_price", precision = 21, scale = 2)
    private BigDecimal unitPrice;

    /**
     * 数量
     */
    @ApiModelProperty(value = "数量")
    @Column(name = "quantity")
    private Integer quantity;

    /**
     * 原单价
     */
    @ApiModelProperty(value = "原单价")
    @Column(name = "origin_unit_price", precision = 21, scale = 2)
    private BigDecimal originUnitPrice;

    /**
     * 包装费
     */
    @ApiModelProperty(value = "包装费")
    @Column(name = "packing_fee", precision = 21, scale = 2)
    private BigDecimal packingFee;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public BigDecimal getPackingFee() {
        return packingFee;
    }

    public void setPackingFee(BigDecimal packingFee) {
        this.packingFee = packingFee;
    }

    public String getItemCode() {
        return itemCode;
    }

    public OrderItem itemCode(String itemCode) {
        this.itemCode = itemCode;
        return this;
    }

    public void setItemCode(String itemCode) {
        this.itemCode = itemCode;
    }

    public String getOrderCode() {
        return orderCode;
    }

    public OrderItem orderCode(String orderCode) {
        this.orderCode = orderCode;
        return this;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    public String getMerchandiseCode() {
        return merchandiseCode;
    }

    public OrderItem merchandiseCode(String merchandiseCode) {
        this.merchandiseCode = merchandiseCode;
        return this;
    }

    public void setMerchandiseCode(String merchandiseCode) {
        this.merchandiseCode = merchandiseCode;
    }

    public String getMerchandiseName() {
        return merchandiseName;
    }

    public OrderItem merchandiseName(String merchandiseName) {
        this.merchandiseName = merchandiseName;
        return this;
    }

    public void setMerchandiseName(String merchandiseName) {
        this.merchandiseName = merchandiseName;
    }

    public String getSpecification() {
        return specification;
    }

    public OrderItem specification(String specification) {
        this.specification = specification;
        return this;
    }

    public void setSpecification(String specification) {
        this.specification = specification;
    }

    public String getPhotos() {
        return photos;
    }

    public OrderItem photos(String photos) {
        this.photos = photos;
        return this;
    }

    public void setPhotos(String photos) {
        this.photos = photos;
    }

    public BigDecimal getUnitPrice() {
        return unitPrice;
    }

    public OrderItem unitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
        return this;
    }

    public void setUnitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public OrderItem quantity(Integer quantity) {
        this.quantity = quantity;
        return this;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public BigDecimal getOriginUnitPrice() {
        return originUnitPrice;
    }

    public OrderItem originUnitPrice(BigDecimal originUnitPrice) {
        this.originUnitPrice = originUnitPrice;
        return this;
    }

    public void setOriginUnitPrice(BigDecimal originUnitPrice) {
        this.originUnitPrice = originUnitPrice;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof OrderItem)) {
            return false;
        }
        return id != null && id.equals(((OrderItem) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    @Override
    public String toString() {
        return "OrderItem{" +
            "id=" + getId() +
            ", itemCode='" + getItemCode() + "'" +
            ", orderCode='" + getOrderCode() + "'" +
            ", merchandiseCode='" + getMerchandiseCode() + "'" +
            ", merchandiseName='" + getMerchandiseName() + "'" +
            ", specification='" + getSpecification() + "'" +
            ", photos='" + getPhotos() + "'" +
            ", unitPrice=" + getUnitPrice() +
            ", quantity=" + getQuantity() +
            ", originUnitPrice=" + getOriginUnitPrice() +
            "}";
    }
}
